<?php 
$this->headScript()->appendFile( $this->baseUrl() . '/public/js/ajaxupload/ajaxfileupload.js' );
$this->headScript()->appendFile( $this->baseUrl() . '/public/js/adminscript.js' );
$this->headScript()->appendScript( 
		'var baseUrl = "'.$this->baseUrl().'";'.
		'var photoUrl = "'.$this->baseUrl().'/public/images/box/";'
	);
?>

<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>

<h2><?php 
foreach ($this->langs as $one)
{
	if(isset($this->des[$one['l_id']]['title'])){
		echo "Edytuj ".$this->des[$one['l_id']]['title'];
	}else echo "Dodaj nowy produkt";	 
	break;
}
?></h2>
<form method="post" id="formitem" enctype="multipart/form-data">
	<table cellpadding="5" border="0" cellspacing="5"  class="tform">
		<tr>
			<td>Nazwa produktu</td>
			<td>
				<?php 
				foreach ($this->langs as $one)
				{
					echo $one['name_long'].':<br />';
					echo $this->formText('title['.$one['l_id'].']', @$this->des[$one['l_id']]['title']).'<br />';			 
				}
				?>
			</td>
		</tr>
		<tr>
			<td>Cena</td>
			<td>
				<?php 
				if(isSet($this->item['price']))
					$price = unserialize($this->item['price']);
				foreach ($this->currency as $one)
				{
					echo $one['name'].':<br />';
					echo $this->formText('price['.$one['name'].']', @$price[$one['name']]).'<br />';			 
				}
				?>
			</td>
		</tr>
		<tr>
			<td>Cena skreślona</td>
			<td>
				<?php 
				foreach ($this->currency as $one)
				{
					echo $one['name'].':<br />';
					echo $this->formText('price['.$one['name'].'_strike]', @$price[$one['name'].'_strike']).'<br />';			 
				}
				?>
			</td>
		</tr>
		<tr>
			<td>Kategoria</td>
			<td>
				<?php echo $this->formSelect('category_c_id', @$this->item['category_c_id'], null, $this->cat_list) ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru S</td>
			<td>
				<?php echo $this->formText('size_s', $this->item['size_s']); ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru M</td>
			<td>
				<?php echo $this->formText('size_m', $this->item['size_m']); ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru L</td>
			<td>
				<?php echo $this->formText('size_l', $this->item['size_l']); ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru XL</td>
			<td>
				<?php echo $this->formText('size_xl', $this->item['size_xl']); ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru XXL</td>
			<td>
				<?php echo $this->formText('size_xxl', $this->item['size_xxl']); ?>
			</td>
		</tr>
		<tr>
			<td>Stan magazynowy rozmiaru XXXL</td>
			<td>
				<?php echo $this->formText('size_xxxl', $this->item['size_xxxl']); ?>
			</td>
		</tr>
		<tr>
			<td>Produkt jest kosztem transportu?</td>
			<td>
				<?php echo $this->formCheckbox('transport', '1' , (@$this->item['transport'] ) ? array("checked" => "checked") : array( )); ?>
			</td>
		</tr>
		<tr>
			<td>Opis produktu</td>
			<td>
				<?php 
				foreach ($this->langs as $one)
				{
					echo $one['name_long'].':<br />';
					echo $this->formTextarea('description['.$one['l_id'].']', @$this->des[$one['l_id']]['description'], '').'<br />' ;			 
				}
				?>
			</td>
		</tr>
		<tr>
			<td>Przyjazny url (jeśli puste, uzupełni się automatycznie)</td>
			<td>
				<?php 
				foreach ($this->langs as $one)
				{
					echo $one['name_long'].':<br />';
					echo $this->formText('url['.$one['l_id'].']', @$this->des[$one['l_id']]['url']).'<br />';				 
				}
				?>
			</td>
		</tr>
	</table>
</form>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do listy</div>
			</a>
		</td>
		<td>
			<a class="button" href="javascript:void(null)" onclick="$('#formitem').submit()">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/save_16.png);" class="inb">Zapisz</div>
			</a>
		</td>
	</tr>
</table>